#!/bin/bash
# A simple bash script to build the zip file for grading purposes
# To execute this file you may need to first execute the following:
# chmod +x submit.sh         (this makes this script executable by the owner )

#usage: ./submit.sh netid1 [netid2] [netid3]

files="shell.c responses.txt"

suffix="mp2.zip"

if [ $# -eq 0 ]; then
	echo -e "Please include your netid(s) as arguments to this script:\n $0 netid1 [netid2] [netid3]" ; exit 1
else if [ $# -gt 3 ]; then 
	echo -e "A maximum of three netids can be included per zip file"; exit 1
		fi
fi

netids="${1}"

if [ $# -ge 2 ]; then
	netids="${netids}-${2}"
fi	
if [ $# -ge 3 ]; then
	netids="${netids}-${3}"
fi

archive="${netids}-${suffix}"
oldArchive="${archive}.old"

if [ -f "$archive" ]; then mv "${archive}" "${oldArchive}" ; fi 
echo -e "Building $archive \nPlease see instructions.txt on how to submit your work to Compass"	
echo -e "For full points ensure you are submitting following edited files:\n ${files}\n"
zip  $archive $files



